package org.huang.feign;

import feign.RequestLine;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

@RestController
public class HiController {

    @Autowired
    SchedualServiceHi schedualServiceHi;

    @Value("${spring.application.name}")
    private String applicationName;

    @RequestMapping(value = "/hi",method = RequestMethod.GET)
    public String sayHi(){
        return   "["+applicationName+"]"+schedualServiceHi.sayHiFromClientOne();
    }


    @RequestMapping(value = "/user/{username}/{age}",method = RequestMethod.GET)
    public String getUser1(@PathVariable String username,@PathVariable Integer age){
        return   "["+applicationName+"]"+schedualServiceHi.getUser1(username,age);
    }

    @GetMapping("/user")
    public String getUser2(String username,Integer age){
        return   "["+applicationName+"]"+schedualServiceHi.getUser2(username,age);
    }


    @GetMapping(value = "/getUser")
    public String getUser3(String username,Integer age){
        User u = new User(username,age);
        System.out.println("参数："+u);
//        return   "["+applicationName+"]"+schedualServiceHi.getUser3(u);
        return   "["+applicationName+"]"+schedualServiceHi.getUser4(u);
    }
}
